#include "unitReader.h"

int main() {
  int ret;
  log_init();
  g_log_context.log_level = LOG_DEBUG;
  UnitReader* ur = new UnitReader();

  DescriptorManager* dm = new DescriptorManager();
  ret = dm->load_without_fdata("conf/resource.ini");
  if(ret != S_RET) {
    FATAL("errpr loading resource ini");
    return E_RET;
  }
  

  ret = ur->load(dm, "./data/unit");
  assert(ret == S_RET);

  int var1_id = ur->get_rsc_id("var1");
  int var2_id = ur->get_rsc_id("var2");

  char* str;
  for(uint32_t id = 0 ; id < 99 ; ++id)  {
    uint32_t len;
    str = ur->get_by_id(id, var1_id, &len);
    NOTICE("[%s][%s]", "var1", str);
    str = ur->get_by_id(id, var2_id, &len);
    NOTICE("[%s][%s]", "var2", str);
}

}
